package cn.edu.sasu.webservice.impl;

import java.util.List;
import java.util.Map;

import cn.edu.sasu.domain.News;
import cn.edu.sasu.http.HttpNewsService;
import cn.edu.sasu.http.HttpUrl;
import cn.edu.sasu.utils.ActivityUtil;
import cn.edu.sasu.webservice.CommentService;

public class CommentServiceImpl implements CommentService {
	private ActivityUtil activityUtil = null;
	private HttpNewsService newsService = null;

	public CommentServiceImpl() {
		activityUtil = new ActivityUtil();
		newsService = new HttpNewsService();
	}

	@Override
	public List<News> getNews(List<News> list, int startIndex, int endIndex,
			String tag) {
		return activityUtil.nextPage(list, startIndex, endIndex, tag);
	}

	@Override
	public List<News> postAndParse(Map<String, String> params) {

		return newsService.parseNews(newsService.requestByPost(
				HttpUrl.url(HttpUrl.NEWS_SELECT), params));
	}
}
